package demo1;

import java.util.*;

/**
 * @Author liangzai
 * @Description:
 */
public class Test {

    //点击消除
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        StringBuilder stringBuilder = new StringBuilder();
        int j = -1;
        for (int i = 0; i < str.length(); i++) {
            if(j==-1 || stringBuilder.charAt(j)!=str.charAt(i)){
                stringBuilder.append(str.charAt(i));
                j++;
            }else{
                stringBuilder.deleteCharAt(j--);
            }
        }
        System.out.println((j==-1) ? "0" :stringBuilder.toString());
    }

    //数字统计
    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int left = scanner.nextInt();
        int right = scanner.nextInt();
        int count = 0;
        for (int i = left; i <= right; i++) {
            int a = i;
            while(a>=0){
                if(a%10==2){
                    count++;
                }
                a /= 10;
            }
        }
        System.out.println(count);
    }

    //字符串的交集
    public ArrayList<Integer> intersection (ArrayList<Integer> nums1, ArrayList<Integer> nums2) {
        // write code here
        ArrayList<Integer> list = new ArrayList<Integer>();
        for (int i = 0; i < nums1.size(); i++) {
            for (int j = 0; j < nums2.size(); j++) {
                if(nums1.get(i).equals(nums2.get(j)) ){
                    list.add(nums1.get(i));
                    nums2.removeAll(list);
                }
            }
        }
        return list;
    }
}
